<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<%@include file="/WEB-INF/templates/common/taglib.jsp"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>${title}</title>
<%@include file="/WEB-INF/templates/common/common.jsp"%>
<style>
	td{border:1px solid red;text-align:center}
	
} 
</style>
<script  type="text/javascript" src="${basePath}/static/My97DatePicker/WdatePicker.js"></script>
<script  type="text/javascript" src="${basePath}/static/js/util.js"></script>
</head>
<body>
 <!--头部-->
 <%@include file="/WEB-INF/templates/common/header.jsp"%>

<!------导航条-->
 <%@include file="/WEB-INF/templates/common/navigation.jsp"%>
<div id="div_login" style="display:none;">
 <div class="login">
  <ul>
  <li>用户名：<INPUT name="txtName" id="txtName" type="text" class="textbox" value=""></li>
  <li>密&nbsp;&nbsp;&nbsp;码：<INPUT name="txtPwd" id="txtPwd" type="text" class="textbox" value=""></li>
  <li><span>R&nbsp;J&nbsp;Y&nbsp;6</span>验证码：<INPUT name="txtName" id="txtName" type="text" class="check" value=""></li>
  <li style="height:35px; margin-top:25px;">
  <a><INPUT name="btnLogin" class="L_up" id="btn_login" type="submit" value="登&nbsp;&nbsp;录"></a>
  <a><INPUT name="btnLogin" class="L_up2" id="closeBtn" type="submit" value="关&nbsp;&nbsp;闭"></a>
  </li>
 </ul>
 </div>
</div>
<div class="list_main lay_out" class="clearfix">
 <div class="list_DH">
    <!--打印模块导航栏-->
 <%@include file="/WEB-INF/templates/common/printnav.jsp"%>
 </div>
 <div class="list_NR">
  <div class="loc">
   <h3>打印申请</h3>
  </div>
  <div class="list_con_table"> 
   
   <div class="search_table" id="addApply" style="height:auto;border:0;">
    <form action="${basePath}/print/addApplyPrint" method="post" id="printForm" style="height:auto;" >
    <ul class="clearfix" style="border:#e3e5e4 1px solid">
    <li class="Label_1" >申请人：&nbsp;<span class="Label_6">*</span></li>
    <li class="Label_2"><input class="input_box" type="text"  maxlength="18" name='applyName' id='applyName' value='' /></li>
    <li class="Label_1">身份证号：&nbsp;<span class="Label_6">*</span></li>
    <li class="Label_2"><input class="input_box" type="text"  maxlength="25" name='applyCard' id='applyCard' value='' /></li>
    <li class="Label_1">和病案所属人关系:<span class="Label_6">*</span></li>
    <li class="Label_2">
    	<select id="applyPatientRelation" name="applyPatientRelation" style="width:99%;height:28px">
    		<option value="1">直系亲属</option>
    		<option value="2">医患关系</option>
    		<option value="3">司法机构</option>
    		<option value="4">其他</option>
    	</select>
    </li>

    <li class="Label_1">申请日期：&nbsp;<span class="Label_6">*</span></li>
    <li class="Label_2"><input type="text" id="applyDate" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" name="applyDate"
					class="input_box"/></li>
    <li class="Label_1">申请原因：&nbsp;</li>
    <li class="Label_2">
    	<select name="applyReason" style="width:99%;height:28px" name="applyReason">
    		<option value="1">门规</option>
    		<option value="2">医保</option>
    		<option value="3">其他</option>
    	</select>
    <%-- <li class="Label_1">预收费用:</li>
    <li class="Label_2">
    <input class="input_box" type="hidden"  name='mrIds' id='mrIds' value='${mrIds}' />
    <input class="input_box" type="text"  name='perPrintFee' id='perPrintFee'  />
    </li> --%>
    <li class="Label_1">联系电话：&nbsp;<span class="Label_6">*</span></li>
    <li class="Label_2"><input class="input_box"  maxlength="15" type="text"  name='linkWay' id='linkWay' value='' /></li>
    <li class="Label_1" >备注：&nbsp;</li>
    <li class="Label_3" style="width:19.7%"><input maxlength="50" class="input_box" type="text"  name='comment' id='' value='' /></li>
    <li class="Label_1">申请方式：&nbsp;</li>
    <li class="Label_2">
    	<select name="applyStyle" style="width:99%;height:28px" name="applyReason">
    		<option value="1">窗口</option>
    		<option value="2">其他</option>
    		<option value="3">门规</option>
    	</select>
    </li>
        <li class="Label_1">是否邮寄:<span class="Label_6">*</span></li>
    <li class="Label_2">
    	<select id="applyPatientRelation" name="applyPatientRelation" style="width:99%;height:28px">
    		<option value="2">否</option>
    		<option value="1">是</option>
    	</select>
    </li>
    <%--  <li class="Label_1">打印单份预计费用:</li>
    <li class="Label_2" style="width:800px;text-align:left">&nbsp;<input id="prePrice"  disabled="disabled" style="width:176px" class="input_box" type=""  value='${prePrice}' /></li> --%>
    <li class="Label_5" style="text-align:right">
    	<input type="hidden" name="printCopies" id="printCopies" value=""/>
    	<!-- <input type="button" value="提交" onclick="submitForm()">&nbsp;&nbsp;&nbsp; -->
        <a onclick="submitForm()">提交</a>&nbsp;&nbsp;&nbsp;
    </li>
    </ul>
    <table class="Search_tableList" cellpadding="0" cellspacing="0">
     <!-- <tr><td colspan="7" style="border-color:#FFF;">
         	<a style="padding:4px 6px;background:#333;color:#FFF" onclick="selectChose()">选中申请</a> 
         </td></tr> -->
      <tr>
      <td class="tdLabel_4">序号<input type="hidden" value="${medListMap[0].name }"/></td>
      <td class="tdLabel_4">姓名</td>
      <td class="tdLabel_4">身份证号</td>
      <td class="tdLabel_4">诊疗记录</td>
      <td class="tdLabel_4">就诊机构</td>
      <td class="tdLabel_4">出院时间</td>
      <td class="tdLabel_4">打印份数</td>
      <td class="tdLabel_4">操作</td>
      </tr>
      <tbody id="tbody">
      	
     	<c:forEach items="${medListMap}" var="mr"  varStatus="xh">
     	<tr>
    	<td  class="tdLabel_5">${xh.count}</td>
    	<td  class="tdLabel_5"><input type="text"  class="input_box" value="${mr.name}" name="applyPrintList[${xh.index}].patientName"></td>
    	<td class="tdLabel_5"><input type="text"  class="input_box" value="${mr.idCard}" name="applyPrintList[${xh.index}].patientCard"></td>
    	<td class="tdLabel_5"><input type="text"  class="input_box" value="${mr.mrId}" name="applyPrintList[${xh.index}].medicalRecord"></td>
    	<td class="tdLabel_5">
    		<input type="text"  disabled="disabled" class="input_box" value="${mr.orgName}">
    		<input type="hidden"  name="applyPrintList[${xh.index}].medicalOnlyId" class="input_box" value="${mr.firstGuid}">
    	</td>
    	
    	<td class="tdLabel_5">${mr.outTime}</td>
    	<%-- <td>${mr.outTime}</td> --%>
    	<td class="tdLabel_5"><select id='copies' mrid="${mr.mrId}" name="applyPrintList[${xh.index}].printCopies" onchange='getPrintCopys(this)'>
	 					    		<option value='1'>1</option>
	 					    		<option value='2'>2</option>
	 					    		<option value='3'>3</option>
	 					    		<option value='4'>4</option>
	 					    		<option value='5'>5</option>
	 					    		<option value='6'>6</option>
	 					    		<option value='7'>7</option>
	 					    		<option value='8'>8</option>
	 					    		<option value='9'>9</option>
	 					    		<option value='10'>10</option>
	 					    	</select></td>
	 		<td class="tdLabel_5">
	 		
	 		<a mrid="${mr.mrId}" onclick="delMrId(this)">删除</a></td>
    	</tr>
	</c:forEach>
    	</tbody>
    </table>
    
    </form>
   </div>
   
   	 
   <!-- 选中申请病案信息 -->
   
 </div>
</div>
</div>
<!--页脚部分-->
 <%@include file="/WEB-INF/templates/common/footer.jsp"%>
 <script>
 	var personCodeReg = /(^\\d{18}$)|(^\\d{15}$)|(^\\d{17}(\\d|X|x)$)/;
 	var phoneReg = /^1[3|4|5|7|8]\d{9}$/;
 	var numReg =  /^[0-9]*/;
 	
 	//获取checkbox值
	 function getFormVals(name){
			var arr = [];
			$("input[type='checkbox'][name='"+name+"']:checked").each(function(){
				arr.push($(this).val());	
			});
			return arr.toString();
	}
 	
 	
	 function delMrId(obj){
		 var $this=$(obj);
		 $this.parent().parent().remove();
	 }
 
 	//表单提交
	function submitForm() {

 		var applyName = $("#applyName").val();
 		if(!applyName) {
 			alert("申请人不能为空!");
 			$("#applyName").addClass("input_change");
 			$("#applyName").focus(function() { 
 			  	$(this).removeClass("input_change");	
 			});
 			return ;
 		}else{
 			if(checkChinese(applyName)){
 				alert("输入姓名格式不正确!");
 				$("#applyName").addClass("input_change");
 	 			$("#applyName").focus(function() { 
 	 			  	$(this).removeClass("input_change");	
 	 			});
 				return;
 			}
 		}
 		
 		
 		var applyCard = $("#applyCard").val();
 		if(!applyCard) {
 			alert("申请人身份证号不能为空!");
 			$("#applyCard").addClass("input_change");
	 			$("#applyCard").focus(function() { 
	 			  	$(this).removeClass("input_change");	
	 			});
 			return ;
 		}else{
 			if(!isCardNo(applyCard)){
 				alert("身份证号格式不正确!");	
 				$("#applyCard").addClass("input_change");
 	 			$("#applyCard").focus(function() { 
 	 			  	$(this).removeClass("input_change");	
 	 			});
 				return;
 			}
 			
 		}
 		
 		 var applyPatientRelation=$("#applyPatientRelation").val();
 		if(!applyPatientRelation){
 				alert("和病案所属人关系不能为空!");
 				$("#applyName").addClass("input_change");
 	 			$("#applyName").focus(function() { 
 	 			  	$(this).removeClass("input_change");	
 	 			});
 				return;
 		}  
 		
 		var linkWay = $("#linkWay").val();
 		if(!linkWay){
 			alert("联系电话不能为空!");
 			$("#linkWay").addClass("input_change");
	 			$("#linkWay").focus(function() { 
	 			  	$(this).removeClass("input_change");	
	 			});
	 		return;
 		}else{
 			if(!phoneReg.test(linkWay)) {
 	 			alert("电话格式不正确!");
 	 			$("#linkWay").addClass("input_change");
 	 			$("#linkWay").focus(function() { 
 	 			  	$(this).removeClass("input_change");	
 	 			});
 	 			return ;
 	 		}
 		}
 		
 		
 		
 	    var applyDate = $("#applyDate").val();
 		if(!applyDate) {
 			alert("申请日期不能为空!");
 			$("#applyDate").addClass("input_change");
	 			$("#applyDate").focus(function() { 
	 			  	$(this).removeClass("input_change");	
	 			});
 			return ;
 		}
 		
 		$("#printForm").submit();
 		
	}	
 
</script>
</body>
</html>
